import { Controller, Get, Post, Body, Param, Delete, Put, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { Dynamic_Service } from './dynamic.service';
import { Dynamic_Create_Dto, Dynamic_Update_Dto } from './assets/dynamic.dto';
import { Dynamic_Find_Dto } from './assets/dynamic.dto';
import { util_ApiResponse_Base } from '@/common/util/apiResponse';
import { util_Index_ReturnContent } from '@/common/util/index';

@Controller('/adm/dynamic')
@ApiTags('dynamic 动态资讯')
export class Dynamic_Controller {
  constructor(private readonly dynamic_Service: Dynamic_Service) {}

  @Post('/add')
  @util_ApiResponse_Base({
    dataType: 'dataType_add',
  })
  async dynamic_Create(@Body() body: Dynamic_Create_Dto) {
    return util_Index_ReturnContent(await this.dynamic_Service.dynamic_Create(body));
  }

  @Get('list')
  @util_ApiResponse_Base({
    dataType: 'dataType_list',
  })
  async dynamic_FindByPage(@Query() query: Dynamic_Find_Dto) {
    return util_Index_ReturnContent(await this.dynamic_Service.dynamic_FindByPage(query));
  }

  @Put('/update')
  @util_ApiResponse_Base({
    dataType: 'dataType_update',
  })
  async dynamic_Update(@Body() body: Dynamic_Update_Dto) {
    return util_Index_ReturnContent(await this.dynamic_Service.dynamic_Update(body));
  }

  @Delete('/delete/:id')
  @util_ApiResponse_Base({
    dataType: 'dataType_delete',
  })
  async dynamic_Remove(@Param('id') id: string) {
    return util_Index_ReturnContent(await this.dynamic_Service.dynamic_Remove(+id));
  }
}
